package com.waimai1.waimai.service;

import com.alibaba.fastjson.JSONObject;
import com.waimai1.waimai.entity.MyOrder;
import com.wechat.pay.java.service.cashcoupons.model.SendCouponResponse;
import com.wechat.pay.java.service.payments.jsapi.model.PrepayResponse;
import com.wechat.pay.java.service.payments.model.Transaction;
import com.wechat.pay.java.service.refund.model.Refund;

import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.security.GeneralSecurityException;

public interface WepayService {
    /** JSAPI支付下单 */
     PrepayResponse prepay(int totalFee,String openid,String OutTradeNo,String goodtag);
     //退款
    Refund refund(String submchid,String out_trade_no, Long totalAmount,Long refundAmount);
//    /** 关闭订单 */
//    void closeOrder();
    /** 微信支付订单号查询订单 */
     Transaction queryOrderById(String id);
    /** 商户订单号查询订单 */
    Transaction queryOrderByOutTradeNo(String OutTradeNo);
    //获取notify的解密resource
    JSONObject getResource(HttpServletRequest request,String apiV3key) throws IOException, GeneralSecurityException;
//    退款
    void allRefund(MyOrder order);
    void partRefund(MyOrder order);
//    发放代金券
    SendCouponResponse sendcoupon(String stockId, String openid);
//    计算部分退款金额
    double partRefundCount(String comment,String partialRefundProduct);
}
